package org.nepu.scr.indexrate.converter.riskrate.equipmentdata;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentdata.CommunicationFlightMenu;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class CommunicationFlightMenuConverter implements AttributeConverter<CommunicationFlightMenu, String> {
    @Override
    public String convertToDatabaseColumn(CommunicationFlightMenu communicationFlightMenu) {
        return JSONUtil.toJsonStr(communicationFlightMenu);
    }

    @Override
    public CommunicationFlightMenu convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, CommunicationFlightMenu.class);
    }
}
